import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AwardVo, AwardForm, AwardQuery } from '@/api/award/types';

/**
 * 查询荣誉信息列表
 * @param query
 * @returns {*}
 */

export const listAward = (query?: AwardQuery): AxiosPromise<AwardVo[]> => {
  return request({
    url: '/lawyer/award/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询荣誉信息详细
 * @param awardId
 */
export const getAward = (awardId: string | number): AxiosPromise<AwardVo> => {
  return request({
    url: '/lawyer/award/' + awardId,
    method: 'get'
  });
};

/**
 * 新增荣誉信息
 * @param data
 */
export const addAward = (data: AwardForm) => {
  return request({
    url: '/lawyer/award/saveAward',
    method: 'post',
    data: data
  });
};

/**
 * 修改荣誉信息
 * @param data
 */
export const updateAward = (data: AwardForm) => {
  return request({
    url: '/lawyer/award/updateAward',
    method: 'post',
    data: data
  });
};

/**
 * 删除荣誉信息
 * @param awardId
 */
export const delAward = (awardId: string | number | Array<string | number>) => {
  return request({
    url: '/lawyer/award/removeAward/' + awardId,
    method: 'delete'
  });
};
